package com.cuitrip.business.user.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.cuitrip.business.home.recommend.model.RecommendTravelTrip;

import java.io.Serializable;
import java.util.List;

public class CtUserInfo implements Serializable {
    private static final long serialVersionUID = 4899849840118146981L;

    public static final int USER_TRAVEL = 0;
    public static final int USER_FINDER = 1;


    public static final int VALIDATE_MASK_PHONE = 1;
    public static final int VALIDATE_MASK_EMAIL = 2;
    public static final int VALIDATE_MASK_IDCARD = 4;
    public static final int VALIDATE_MASK_INTERNATION_CARD = 8;
    public static final int VALIDATE_MASK_WECHAT = 16;
    public static final int VALIDATE_MASK_FACEBOOK = 32;
    public static final int VALIDATE_MASK_GOOGLE = 64;
    public static final int VALIDATE_MASK_WEIBO=128;

    public static final int ID_CHECK_ING = 0;//审核中
    public static final int ID_CHECK_SUC = 1;//审核成功
    public static final int ID_CHECK_FAILED = 2;//审核失败
    public static final int ID_CHECK_NONE = 3;//空默认状态

    public static final int HAS_NPS_INFO = 1;
    public static final int NO_NPS_INFO = 0;

    public static final String MALE = "1";
    public static final String FEMALE = "2";

    private String uid; //": "3",
    private String nick; //: "Rosa",
    private String status; //": "0",
    private String realName; //": "",
    private String country; //: "TW",
    private String city; //: "台灣",
    private String countryCode; //: "886",
    private String mobile; //: "0939081318",
    private String email; //: "",
    private String gender; //: "2",
    private String headPic; //: "http://cuitrip.oss-cn-shenzhen.aliyuncs.com/3_1434898588997",
    private String sign; //: "啟發他人，感動自己",
    private String language; //: "英文、中文",
    private String career; //: "Tripper!",
    private String interests; //: "調酒、美食、新奇事物",
    private String extInfo; //: "",
    private String gmtModified; //: "2015-07-08 10:36:31",
    private String gmtCreated; //: "2015-06-21 04:39:09",
    private String token; //: "d687f2911096a74316f521491c928ec0"
    private String birthDay;
    private String rongyunToken;
    private String introduce;
    private int validType; // 验证方式：1 手机 2 邮箱 4 身份证 8 护照； 3表示通过手机和邮箱认证 16微信 ,32 facebook , 64 google,128 weibo
    private String idNumber; // 身份证号

    private String idArea;
    private String idType;
    private String idValidTime;
    private int idCheckStatus=ID_CHECK_NONE;
    private String idPictures;
    private String idRefuseReason;
    private int hasUnReadMsg;
    private boolean isNewUser;
    @JSONField(name = "hasPasswd")
    private boolean hasPasswrd;
    private int languageCode;
    private int unReadMsgNum;
    private int hasNpsInfo;
    @JSONField(name = "allService")
    private List<RecommendTravelTrip> travelTripList;
    private boolean isFinished;//基本信息是否完善
    public boolean isFinished() {
        return isFinished;
    }
    public void setIsFinished(boolean isFinished) {
        this.isFinished = isFinished;
    }


    public int getHasUnReadMsg() {
        return hasUnReadMsg;
    }

    public void setHasUnReadMsg(int hasUnReadMsg) {
        this.hasUnReadMsg = hasUnReadMsg;
    }

    public String getIntroduce() {
        return introduce;
    }

    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    public String getIdArea() {
        return idArea;
    }

    public void setIdArea(String idArea) {
        this.idArea = idArea;
    }

    public String getIdType() {
        return idType;
    }

    public void setIdType(String idType) {
        this.idType = idType;
    }

    public String getIdValidTime() {
        return idValidTime;
    }

    public void setIdValidTime(String idValidTime) {
        this.idValidTime = idValidTime;
    }

    public int getIdCheckStatus() {
        return idCheckStatus;
    }

    public void setIdCheckStatus(int idCheckStatus) {
        this.idCheckStatus = idCheckStatus;
    }

    public String getIdPictures() {
        return idPictures;
    }

    public void setIdPictures(String idPictures) {
        this.idPictures = idPictures;
    }

    public String getIdRefuseReason() {
        return idRefuseReason;
    }

    public void setIdRefuseReason(String idRefuseReason) {
        this.idRefuseReason = idRefuseReason;
    }

    public String getRongyunToken() {
        return rongyunToken;
    }

    public void setRongyunToken(String rongyunToken) {
        this.rongyunToken = rongyunToken;
    }

    public int getLanguageCode() {
        return languageCode;
    }

    public void setLanguageCode(int languageCode) {
        this.languageCode = languageCode;
    }

    public boolean isPhoneValidated() {
        return (validType & VALIDATE_MASK_PHONE) == VALIDATE_MASK_PHONE;
    }

    public boolean isWeiboValidated(){
        return (validType & VALIDATE_MASK_WEIBO)==VALIDATE_MASK_WEIBO;
    }

    public boolean isEmailValidated() {
        return (validType & VALIDATE_MASK_EMAIL) == VALIDATE_MASK_EMAIL;
    }

    public boolean isWechatValidated() {
        return (validType & VALIDATE_MASK_WECHAT) == VALIDATE_MASK_WECHAT;
    }

    public boolean isFacebookValidated() {
        return (validType & VALIDATE_MASK_FACEBOOK) == VALIDATE_MASK_FACEBOOK;
    }

    public boolean isGoogleValidated() {
        return (validType & VALIDATE_MASK_GOOGLE) == VALIDATE_MASK_GOOGLE;
    }

    public boolean isIdentityValidated() {
        return idCheckStatus == ID_CHECK_SUC;
    }

    public String getBirthDay() {
        return birthDay;
    }

    public void setBirthDay(String birthDay) {
        this.birthDay = birthDay;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public int getValidType() {
        return validType;
    }

    public void setValidType(int validType) {
        this.validType = validType;
    }

    private int type; //用户身份 0：旅行者 1：发现者

    public boolean isTravel() {
        return type == USER_TRAVEL;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCountryCode() {
        return countryCode;
    }

    public void setCountryCode(String countryCode) {
        this.countryCode = countryCode;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getHeadPic() {
        return headPic;
    }

    public void setHeadPic(String headPic) {
        this.headPic = headPic;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language;
    }

    public String getCareer() {
        return career;
    }

    public void setCareer(String career) {
        this.career = career;
    }

    public String getInterests() {
        return interests;
    }

    public void setInterests(String interests) {
        this.interests = interests;
    }

    public String getExtInfo() {
        return extInfo;
    }

    public void setExtInfo(String extInfo) {
        this.extInfo = extInfo;
    }

    public String getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(String gmtModified) {
        this.gmtModified = gmtModified;
    }

    public String getGmtCreated() {
        return gmtCreated;
    }

    public void setGmtCreated(String gmtCreated) {
        this.gmtCreated = gmtCreated;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public List<RecommendTravelTrip> getTravelTripList() {
        return travelTripList;
    }

    public void setTravelTripList(List<RecommendTravelTrip> travelTripList) {
        this.travelTripList = travelTripList;
    }

    public boolean isNewUser() {
        return isNewUser;
    }

    public void setIsNewUser(boolean isNewUser) {
        this.isNewUser = isNewUser;
    }

    public boolean isHasPasswrd() {
        return hasPasswrd;
    }

    public void setHasPasswrd(boolean hasPasswrd) {
        this.hasPasswrd = hasPasswrd;
    }

    public int getHasNpsInfo() {
        return hasNpsInfo;
    }

    public void setHasNpsInfo(int hasNpsInfo) {
        this.hasNpsInfo = hasNpsInfo;
    }

    public boolean hasAlreadyNpsInfo(){
        return this.hasNpsInfo == HAS_NPS_INFO;
    }

    public int getUnReadMsgNum() {
        return unReadMsgNum;
    }

    public void setUnReadMsgNum(int unReadMsgNum) {
        this.unReadMsgNum = unReadMsgNum;
    }


    public static void copyFrom(CtUserInfo mCtUserInfo, CtUserInfo user) {
        if (user==null){
            return;
        }
        mCtUserInfo.nick=user.nick;
        mCtUserInfo.headPic=user.headPic;
        mCtUserInfo.career=user.career;
        mCtUserInfo.interests=user.interests;
        mCtUserInfo.language=user.language;
        mCtUserInfo.validType=user.validType;
        mCtUserInfo.idCheckStatus=user.idCheckStatus;
        mCtUserInfo.idNumber=user.idNumber;
        mCtUserInfo.email=user.email;
        mCtUserInfo.city=user.city;
        mCtUserInfo.countryCode=user.countryCode;
        mCtUserInfo.mobile = user.mobile;
        mCtUserInfo.introduce=user.introduce;
        mCtUserInfo.hasPasswrd=user.hasPasswrd;
        mCtUserInfo.languageCode=user.languageCode;
        mCtUserInfo.unReadMsgNum=user.unReadMsgNum;
        mCtUserInfo.hasNpsInfo=user.hasNpsInfo;
    }
}
